package com.mfl.controller.user;

import com.mfl.common.PageResult;
import com.mfl.common.Result;
import com.mfl.pojo.dto.PostRemarkDTO;
import com.mfl.pojo.dto.PostRemarkPageQueryDTO;
import com.mfl.service.PostRemarkService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController("userPostRemarkController")
@RequestMapping("/cky/user/postRemark")
@Slf4j
public class PostRemarkController {

    @Autowired
    private PostRemarkService postRemarkService;

    /**
     * 新增帖子回复
     * @param postRemarkDTO
     * @return
     */
    @PostMapping("/insert")
    public Result insert(@RequestBody PostRemarkDTO postRemarkDTO){
        log.info("新增帖子回复：{}", postRemarkDTO);
        postRemarkService.insert(postRemarkDTO);
        return Result.success("回复成功");
    }

    /**
     * 分页查询帖子回复信息
     * @param postRemarkPageQueryDTO
     * @return
     */
    @GetMapping("/pageQuery")
    public Result<PageResult> pageQuery(PostRemarkPageQueryDTO postRemarkPageQueryDTO){
        log.info("分页查询帖子回复信息，{}", postRemarkPageQueryDTO);
        PageResult pageResult = postRemarkService.pageQuery(postRemarkPageQueryDTO);
        return Result.success("",pageResult);
    }

}
